home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
003.dms
/
003.adf
/
EXAMPLE_PROGRAMS
/
example17.AMOS
/
example17.amosSourceCode
Wrap
AMOS Source Code
|
1993-02-25
|
2KB
|
67 lines
Rem example17.Amos
'
Rem A very simple program using dimensioned arrays and procedures
'
'
Rem s is a variable to tell us if the teams have been sorted or not
Rem if s=0 then not sorted if s=1 then teams are sorted
S=0
'
'
Rem Dimension an array called team$ with 22 entries the array counts from 0.
Dim TEAM$(21)
'
'
Rem make the variables s and team$() (array) accessable inside procedures
Global S,TEAM$()
'
'
Rem make sure the data pointer is at the beginning of data line.
Restore TEAMDATA
'
'
Rem using a for next loop read the data into team$(a)
For A=0 To 21
Read TEAM$(A)
Next A
'
'
Rem call the procedure called _showteams to, show the teams.
_SHOWTEAMS
'
'
Rem call procedure to sort the teams into order
_SORTTEAMS
'
'
Rem call showteams again to reprint the teams that are now sorted
_SHOWTEAMS
'
'
Rem to open a procedure, click mouse on line then click on FOLD/UNFOLD
Rem at top of screen (2nd box from left)
Procedure _SHOWTEAMS
Curs Off : Paper 0 : Hide : Cls 0
For A=0 To 21
Locate 14,A : Print TEAM$(A)
Next A
Locate 0,24
If S=0 Then Centre "PRESS A KEY TO SORT TEAMS"
If S=1 Then Centre "TEAMS SORTED"
Clear Key : Wait Key
End Proc
'
'
Rem the actual sortteams procedure unfold this too
Procedure _SORTTEAMS
Sort TEAM$(0)
S=1
End Proc
'
'
Rem this is the team data that gets read into team$(a)
TEAMDATA:
Data "ARSENAL","SPURS","ASTON VILLA","LEEDS","CHELSEA","OLDHAM"
Data "MAN UTD","MAN CITY","IPSWICH","SWINDON","SOUTHAMPTON","BLACKBURN"
Data "NEWCASTLE","WIMBELDON","LIVERPOOL","WEST HAM","COVENTRY","EVERTON"
Data "SHEFF UTD","SHEFF WED","Q.P.R","NORWICH"